package bman.tools;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class JString
{
	static Map patternMap = new HashMap();
	
	public static String getMatch(String pattern, String s)
	{
		Pattern p = (Pattern)patternMap.get(pattern);
		
		if(p == null)
		{
			p = Pattern.compile(pattern);
			patternMap.put(pattern,p);
		}
		
		Matcher m = p.matcher(s);
		if(m.matches())
		{
			return m.group(1);
		}
		else
		{
			return null;
		}
	}
	

}
